package com.zntg.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
 * @program: 映射本地磁盘为静态访问目录
 * @description:
 * @author: zhengyunfei
 * @create: 2018-12-28 09:18
 **/
@Component
public class WebConfigurer implements WebMvcConfigurer {
    /**电子签章生成路径*/
    @Value("${template.targetPath}")
    String targetPath;
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        /**
         * 资源映射路径
         * addResourceHandler：访问映射路径
         * addResourceLocations：资源绝对路径
         */
        registry.addResourceHandler("/files/**").addResourceLocations("file:"+targetPath);
    }

}
